package com.example.foodsy.controller;

import com.example.foodsy.dto.AddressDTO;
import com.example.foodsy.dto.Result;
import com.example.foodsy.utils.Result;
import com.example.foodsy.entity.RetaInfo;
import com.example.foodsy.service.RetaInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/consumer")
@CrossOrigin
public class ConsumerController {
	@Autowired
	private RetaInfoService retaInfoService;


	//通过朔源码进行朔源
	@GetMapping("/getInfoByQR")
	public Result  getInfoByQR(@RequestParam String qrCode){
		AddressDTO<RetaInfo> addressDTO =  retaInfoService.getInfoByQR(qrCode);
		if(addressDTO != null){
			return Result.ok(addressDTO);
		}else {
			return Result.fail("未能通过朔源码查询到该信息");
		}

	}
}
